RtCreateTimerEx

RtCreateTimerEx creates a timer associated with the specified clock, and returns a handle to the timer. Use this call, instead of RtCreateTimer, if you are developing for an RTX dedicated system and want to set the affinity for the timer handler.

Syntax

HANDLE RtCreateTimerEx(
    PSECURITY_ATTRIBUTES pThreadAttributes,
    ULONG StackSize,
    VOID (RTFCNDCL *pRoutine) (PVOID context),
    PVOID Context,
    ULONG Priority,
    CLOCK Clock,
    KAFFINITY ProcessorEnableMask
);

Parameters

pThreadAttributes (ignored by RTSS)

An optional pointer to a SECURITY_ATTRIBUTES structure to be used at handler thread creation. Pass in NULL for default.

StackSize

The stack size for handler thread. Use a size of 0 for default.

Routine

A pointer to the routine to be run upon completion. The routine takes a single PVOID argument and returns VOID.

Context

The argument to the routine, cast as a PVOID.

Priority

The handler thread priority as defined below.

Clock

A clock identifier. Legal clock values, as enumerated in rtapi.h, are listed below:

Clock Value

Meaning

CLOCK_1

One millisecond timer.

CLOCK_2

Real-time HAL timer. Default is 100 microseconds.

CLOCK_3

Real-time HAL timer.  Use the actual timer period to set and deliver the clock values, to calculate the expiration values and response latencies of timers based on this clock.

CLOCK_FASTEST

The fastest available clock and time on the system. This is usually CLOCK_2.

CLOCK_SYSTEM

Same as CLOCK_1.

ProcessorEnableMask

Specifies the KAFFINITY mask that represents the set of RTSS processors on which the timer handler can run. See Specifying a Processor Affinity Bitmask for more details. Once a timer handler thread has started, it cannot be moved to another processor.

Return Values

A non-zero handle to the timer if the function succeeds, a NULL handle if the function fails

To set the timer to expire, see RtSetTimer or RtSetTimerRelative. When the timer expires, the specified routine runs with the specified argument.

Remarks

The timer routine will run as a separate handling thread. pThreadAttributes, StackSize, Priority and ProcessorEnableMask are used to control the creation of the handler thread. See CreateThread and SetThreadPriority for details on these parameters.

To run a different handling routine/context, a new timer must be created.

Requirements

Header Rtapi.h
Library Rtx_Rtss.lib

See Also:

RtCancelTimer

RtDeleteTimer

RtGetClockResolution

RtGetClockTime

RtGetClockTimerPeriod

RtSetClockTime

RtSetTimer

RtSetTimerRelative

IntervalZero.com | Support | Give Feedback